home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 76623,2065@compuserve.com (Bobby Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: Please please help a newbie!
- Date: 16 Feb 1996 17:58:49 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4g2gkq$10h@dub-news-svc-3.compuserve.com>
- References: <4ftoe8$5a2@pacifica.access.ch>
- Reply-To: 76623,2065@compuserve.com (Bobby Martin)
- NNTP-Posting-Host: hd36-146.compuserve.com
- X-Newsreader: IBM NewsReader/2 v1.03
-
- It looks as if your code is fine. You just need to either rename your file with
- a .cpp extension or use whatever compiler flag to tell your compiler it is a
- C++ rather than a C file.
-
- Hope that helps!
- Bobby Martin
-
- In <4ftoe8$5a2@pacifica.access.ch>, tombeck@usemail.com (Thomas Beck) writes:
- >Hi there!
- >
- >It's quite embarrassing to ask those two questions, because they seem
- >absolutely stupid (they probably are). Yesterday I started to learn C/C++. I
- >bought a 700 pages book with a cd included that has two compilers on it). I
- >fully understand the chapter about the types, but the things I program just
- >can't be compiled. I extracted the following two problems:
- >
- >----------- example 1: -------------
- >int i;
- >int & a=i;
- >
- >main() {
- >}
- >--------------------------------------------
- >
- >This is not compiled, I get the following output with Symantec C++ 6.11:
- >
- >D:\SC>sc test1.c
- >
- >sccx test1.c
- >int & a=i;
- > ^
- >test1.c(2) : Error: '=', ';' or ',' expected
- >
- >--- errorlevel 1
- >
- >The second thing that doesn't work is this:
- >
- >----------- example 2: -------------
- >struct abc {
- > int i;
- > char a;
- > void f1() {
- > };
- >};
- >
- >main() {
- >}
- >---------------------------------------------
- >
- >This isn't compiled either, here's the output:
- >
- >D:\SC>sc test2.c
- >
- >sccx test2.c
- > void f1() {
- > ^
- >test2.c(4) : Error: illegal type for 'f1' member
- >
- >--- errorlevel 1
- >
- >
- >Before you think I'm absolutely stupid... I used to be very good at Pascal
- >(TP 6.0), and I'm also experienced in OOP under Pascal. I have no clue of
- >C++, however, and I can only rely on what's written in that book. Apparently
- >it doesn't tell me the truth, does it?
- >
- >Can you please help me with those two problems (referenced variable and
- >function within a class), so that I can go on and learn a few more difficult
- >things?
- >
- >Thanks in advance,
- >
- >Thomas Beck, tombeck@usemail.com
- >
- >=================================================================
- >Summer's day, as she passed away. Birds were singing in the
- >summer sky; then came the rain, and once again, a tear fell
- >from her mother's eye...
- >=================================================================
- >
-
-